/*1014修改
//$("arrowL").style.visibility ="visible";
//$("arrowR").style.visibility ="hidden";

//$("arrowR").style.visibility ="visible";
//$("arrowL").style.visibility ="hidden";
css样式
图片
*/
		
//iPanel.focus.borders = 0;//边框
//iPanel.focusWidth = 0; //宽度

function set(){
	//iPanel.focus.borders = 4;//边框
	//iPanel.focusWidth = 4; //宽度
}
var ABC="";
var flag = 0;//区域 0：上方导航栏  1：左边功能按钮  2：精彩推荐栏  3:下方信息条  4：右侧推荐栏  5:左边大按钮状态
///////////////////每个区域对应的变量///////////////////////////////////////////////////
var focus0_pos = 0;//范围0-10
var focus0_ca = 0;//顶部导航栏表示第几个div框 范围0-7
var focus1_pos = 0;//范围0-26
var focus2_pos = 0;//范围0-3
var focus3_pos = 0;//范围0-1
var focus4_pos = 0;//范围0

////////////////////////////////////////////////////////////////////////////////////////


///////////////////////#1018修改11个顶部导航按钮的链接////////////////////////////////////////////
var ser_focus0_pos = {
	name:["直播","回放","电影","电视剧","新闻","栏目","娱乐","体育","全媒体","亿家游","点点乐园","教育","淘宝","财经","家银通","时尚","音乐","营业厅"]
	,url:["http://utc.hzdtv.tv:80/templates/iptvtest/runtime/iptv0712/template/index/none.htm", // 直播
		  "http://utc.hzdtv.tv:80/templates/iptvtest/runtime/iptv0712/template/huifang/contentsInMultiChannelNew.jsp", // 回放
		  "movie_index.htm","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_012","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_005","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_008","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_007","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_006",
		  "http://125.210.229.35/lwms-tv/index.do?siteNo=10000&stbid=11990009900000E04C00042E&siteType=hd&returnUrl=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 全媒体
		  "http://125.210.228.101/game/gonggao.jsp?code=571&city=1435&stbid=11990009900000E04C00042E&type=1&platform=2", // 游戏
		  "/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_014",
		  "http://hzmp4-stbepg.hzdtv.tv:8080/tvportal/hangzhoujbx-Tvportal,0,hz_stb_01_017,0,25,1.page", // 教育
		  "http://tv.taobao.com/index.htm?dtv=7&stbid=11990009900000E04C00042E", // 淘宝
		  "http://125.210.229.35/lwms-tv/finslide.jsp?vflag=4&ext=1&stbid=11990009900000E04C00042E&returnUrl=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 财经
		  "http://125.210.228.101/jyt/index.jsp?epgCode=010105&stbID=11990009900000E04C00042E", // 家银通
		  "/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_010","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_009",
		  "http://125.210.207.86:8082/boss-self/newself/hzselfservice/hd/index.jsp?stbid=11990009900000E04C00042E" // 营业厅

		 ]
	};
////////////////////////////////////////////////////////////////////////////////////////
/////////////////////左边menu区域/////////////////////////////
//名称
var menuInfo = [
	["亚洲影院","欧美影院","精品剧场","探索纪实","风尚音乐","综合频道","高清直播","高清影视","高清纪录","高清综艺","3D直播","少儿动漫"]
	,["最爱迪士尼","索尼大片","华纳专区","TVB港剧","环球专区","BBC专区","Discovery","英超联赛",getSubStr1("乐视网",5),getSubStr1("PPTV",5)]
	,[
		getSubStr1("城市猎人",5),
	  
		getSubStr1("爱要有你才完美",5),
	  
		getSubStr1("自鸣鼓",5),
	  
		getSubStr1("乡村爱情交响曲",5),
	  
		getSubStr1("乡村爱情故事",5),
	  
		getSubStr1("我爱HK开心万岁",5),
	  
		getSubStr1("战国",5),
	  
		getSubStr1("黑金帝国",5),
	  
		getSubStr1("五路追杀令2 :刺客舞会",5),
	  
		getSubStr1("黄金罗盘",5)
	  ]
	,["时尚影视包","新闻","体育","娱乐","栏目","时尚","音乐"]
	,["亿&nbsp;家&nbsp;游","动感游戏","财&nbsp;&nbsp;&nbsp;&nbsp;经","家&nbsp;银&nbsp;通","点点乐园","电视学堂","幼儿天地","淘&nbsp;&nbsp;&nbsp;&nbsp;宝","卡拉ＯＫ","携程机票","电视杂志","更多...."]

	,["全&nbsp;媒&nbsp;体","96345","政&nbsp;&nbsp;&nbsp;&nbsp;务","长途出行","杭城物价","交通信息"]
]

	//最爱迪斯尼



//索尼iptvtest_001_011_021 



//华纳专区iptvtest_001_011_005 



//TVB港剧iptvtest_001_012_007 



//kbsiptvtest_001_012_009



//BBC


//Discovery


//英超


//获得PPTV栏目对象


//获得乐视网栏目对象


//址址



var menuHref = [
	["http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3801&args=index","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3802&args=index","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3901&args=index","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3803&args=index","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3804&args=index","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3902&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_017","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_003","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_015","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_002_002","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/3Dzhibo/none_v3.htm","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/gqkb/none_gqkb_new.jsp?channel_id=3903&args=index"]
	,["/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_014_008&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_011_021&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_011_005&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_012_018&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=42645&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_008_013&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_008_014&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_006_011&args=index","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_026_001_001","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_026_002_001"]
	,[
		
		"http://utc.hzdtv.tv:80/a?t=37&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=4519561",
	  
		
		"http://utc.hzdtv.tv:80/a?t=37&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=4374657",
	  
		
		"http://utc.hzdtv.tv:80/a?t=37&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=4398392",
	  
		
		"http://utc.hzdtv.tv:80/a?t=37&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=4499389",
	  
		
		"http://utc.hzdtv.tv:80/a?t=37&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=4509346",
	  
		
		"http://utc.hzdtv.tv:80/a?t=36&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=890134",
	  
		
		"http://utc.hzdtv.tv:80/a?t=36&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=1065995",
	  
		
		"http://utc.hzdtv.tv:80/a?t=36&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=4206466",
	  
		
		"http://utc.hzdtv.tv:80/a?t=36&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=3716851",
	  
		
		"http://utc.hzdtv.tv:80/a?t=36&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021&a=3920227"
	  ]
	,["/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_004","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_005","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_006","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_007","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_008","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_010","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_009"]

	,["http://125.210.228.101/game/gonggao.jsp?code=571&city=1435&stbid=11990009900000E04C00042E&type=1&platform=2", // 亿家游
	  "http://125.210.228.170:8881/gp3-tv/index.html?returnU=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 体感游戏
	  "http://125.210.229.35/lwms-tv/finslide.jsp?vflag=4&ext=1&stbid=11990009900000E04C00042E&returnUrl=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp",	// 财经  
	  "http://125.210.228.101/jyt/index.jsp?epgCode=010105&stbID=11990009900000E04C00042E", // 家银通
	  "/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_014", // 点点乐园
	  "http://hzmp4-stbepg.hzdtv.tv:8080/tvportal/hangzhoujbx-Tvportal,0,hz_stb_01_024_009_009_005,0,10,1.page?stbid=11990009900000E04C00042E&return_url=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 电视学堂
	  "http://hzmp4-stbepg.hzdtv.tv:8080/tvportal/hangzhoujbx-Tvportal,0,hz_stb_01_024_010,0,5,1.page?stbid=11990009900000E04C00042E&return_url=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 幼儿天地
	  "http://tv.taobao.com/index.htm?dtv=7&stbid=11990009900000E04C00042E", // 淘宝
	  "http://125.210.228.101/karaoke_gq/redirector_login.jsp?areaflag=330100&stbid=11990009900000E04C00042E&return_url=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 卡拉ＯＫ
	  "http://125.210.228.101/ctrip/flightindex.jsp?tvtype=210&stbtype=1&stvId=11990009900000E04C00042E&homepage=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp",// 携程机票
	  "http://125.210.229.131:9001/tvzine/index.do?stbid=11990009900000E04C00042E",//电视杂志
	  "http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/yingyong/yingyong.jsp"//更多
	  ]

	,["http://125.210.229.35/lwms-tv/index.do?siteNo=10000&stbid=11990009900000E04C00042E&siteType=hd&returnUrl=http%3A%2F%2Futc.hzdtv.tv%2Findex.jsp", // 全媒体
	  "http://125.210.220.81:8080/HSCommunity1/action/weather.do?w=toIndex&stbId=11990009900000E04C00042E&type=10", // 96345
	  "http://tvportal-stbepg.hzdtv.tv:8080/epg/HZ-Tvportal,0,hz_stb_0022.page", // 政务
	  "http://125.210.220.81:8080/TESTHSIPTV/bus.do?b=LmList&stbId=11990009900000E04C00042E&type=10", // 长途出行
	  "http://125.210.220.89:8080/PriceFront/action/msjgxx/WjHome?stbid=11990009900000E04C00042E&type=10", // 杭城物价
	  "http://125.210.220.89:8080/TrafficManager/traffic.do?t=toNewsList1&stbId=11990009900000E04C00042E&type=10" // 交通信息
	 ]
]
//标签地址
var tagHref = ["/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=42769","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/pingpai/pingpai.jsp","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_021","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/mianfei/mianfei.jsp","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/yingyong/yingyong.jsp","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/information/information.jsp"];

///////////////////////底部精彩推荐按钮的链接///////////////////////////////////////
//娱乐热点_超人气网络红人




var ser_focus2_pos = {
	pic:["#","#","#","images/index/index_hot_icon.jpg"]
	,text:["推荐1","推荐2","推荐3","推荐图片"]
	,name:[
			
				
					
					
				

				

					getSubStr("俄罗斯将于5号公布选举初步结果",30),

			
		
				
					
					
				

				

					getSubStr("十大教练指挥习惯 穆帅写纸条爵爷口香糖",30),

			
		
				

				
					
					
					
				

					getSubStr("子孙男丁全是聋哑人 家族陷恶毒诅咒？",30),

			
			
	]
	,url:[
		
   //走鉴权
"http://utc.hzdtv.tv:80/templates/iptvtest/runtime/iptv0712/common/continue_play/continue_play.jsp?assetId=4782445&assetType=13&folderCode=iptvtest_001_020&segmentIndex=2",

   //走鉴权
"http://utc.hzdtv.tv:80/templates/iptvtest/runtime/iptv0712/common/continue_play/continue_play.jsp?assetId=4694649&assetType=13&folderCode=iptvtest_001_020&segmentIndex=2",

   //走鉴权
"http://utc.hzdtv.tv:80/templates/iptvtest/runtime/iptv0712/common/continue_play/continue_play.jsp?assetId=4712127&assetType=15&folderCode=iptvtest_001_020&segmentIndex=2",
			
	"#"
	]
	};





///////////////////////////////////////////////////////////////////////////////////

///////////////////////#1018底部信息栏的链接///////////////////////////////////////






var bannerURL =["http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/gonggao.jsp?num=0","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/gonggao.jsp?num=1","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/gonggao.jsp?num=2","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/gonggao.jsp?num=3","http://utc.hzdtv.tv/templates/iptvtest/runtime/iptv0712/template/index/gonggao.jsp?num=4"];
//var curBannerURL = bannerURL[0];
var ser_focus3_pos = {
	text:["小喇叭","信息栏","更多"]
	,name:["#","信息栏","更多"]
	,url:[bannerURL[0],"/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_025","#"]
};
///////////////////////////////////////////////////////////////////////////////////

///////////////////////右侧gif图片链接///////////////////////////////////////
var ser_focus4_pos = {
	pic:["images/index/index_poster_1_3_2.jpg"]
	,name:["gif图片"]
	,url:["/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=44065","/a?u=RDIPTV_HZHX_IPS_02133041916646915&f=44056","http://utc.hzdtv.tv:80/a?t=36&u=RDIPTV_HZHX_IPS_02133041916646915&f=iptvtest_001_011_007&a=885508"]};
	//http://utc.hzdtv.tv:80/templates/iptvtest/runtime/iptv0712/template/mov/movie_pa/index.jsp 
///////////////////////////////////////////////////////////////////////////////////

//获取cookie字符串
var strCookie=document.cookie;
var stbid="";
//alert(strCookie);
//将多cookie切割为多个名/值对
var arrCookie=strCookie.split("; ");
//遍历cookie数组，处理每个cookie对
for(var i=0;i<arrCookie.length;i++){
  var arr=arrCookie[i].split("=");
  //找到名称为stbid的cookie，并返回它的值
  if("stbid"==arr[0]){
 stbid=arr[1];
 //return stbid;
  }      
}

function $(_id){
	return document.getElementById(_id);
}
////////////////////////////////////左侧menu区域  function//////////////////////////////////
var isMenuListFocus = false;
var menuToList = [[6,7,230],[8,9,300],[10,11,375],[12,13,450],[14,15,530],[16,17,610]];
var menuListFocusStep = 39;
var menuListFocusInit = 187;
var menuListBjPos = [181,137,480]
var MaxMenu = 17;
var curMenu = 0;
var blackColor = "#000000";
var whiteColor = "#ffffff";
////////////////tag图预加载/////////////////////////////////
var loadImgF = new Array(6);
var loadImgFa = new Array(6);
function preloader() {
 	for(var i = 0; i<loadImgF.length; i++){
		loadImgF[i] = new Image(); 
		loadImgFa[i] = new Image(); 
		loadImgF[i].src = "images/index/hd/menu"+i+"_f.png";
		loadImgFa[i].src = "images/index/hd/menu"+i+"_fa.png";
	}
}

/* function checkImages() {
  var result = false;
  result = i.complete;
  if (result) {
     alert("complete");
  } else {
     window.setTimeout("checkImages()",1000);
  }
 }*/

function smallerMenuListBj(){
	var menuListBjObj = $("menuListBj").getElementsByTagName("img")[0];
	menuListBjObj.style.top = menuToList[curMenu][2];
	menuListBjObj.style.width = "1px";
	menuListBjObj.style.height = "1px";
}
function biggerMenuListBj(){
	var menuListBjObj = $("menuListBj").getElementsByTagName("img")[0];
	menuListBjObj.style.top = menuListBjPos[0]+"px";
	menuListBjObj.style.width = menuListBjPos[1]+"px";
	menuListBjObj.style.height = menuListBjPos[2]+"px";
}
function loadMenuList(){
	for(var i=0; i<menuListObj.length; i++){
		if(i<menuInfo[curMenu].length)
			menuListObj[i].innerHTML = menuInfo[curMenu][i];
		else{
			menuListObj[i].innerHTML = "&nbsp;";
		}
	}
	$("menuListBj").getElementsByTagName("img")[0].src = "images/index/hd/menuListBj"+curMenu+".png"
}
function clearTimer(Timer){
	if(Timer != null){
		clearTimeout(Timer);
		Timer = null;
	}
}
var menuChangeTime,menuListTimer;		
function menuIn(){
	$("menuListBjImg").style.webkitTransitionDuration="400ms";
	if(focus1_pos>=0&&focus1_pos<=5){
	
		//biggerMenuListBj();//增大MenuListBj
		$("menu"+focus1_pos).src = loadImgFa[focus1_pos].src;
		curMenu = focus1_pos;
		clearTimer(menuChangeTime);
		menuChangeTime = setTimeout("loadMenuList()",500);
		//$("menuListBj").getElementsByTagName("img")[0].src = "HD1/menuListBj"+focus1_pos+".png"
		MaxMenu = menuInfo.length+menuInfo[focus1_pos].length-1;
	}else{
		clearTimer(menuListTimer);
		menuListTimer = setTimeout(function(){menuListObj[focus1_pos-menuToList.length].style.color = whiteColor;},300)
		if(isMenuListFocus){
			$("menuListFocus").style.visibility = "visible";
			$("menuListFocus").style.top = menuListFocusInit + (focus1_pos-menuToList.length)*menuListFocusStep +"px";
		}else{
			$("menuListFocus").style.visibility = "visible";
			isMenuListFocus = true;
			focus1_pos = 6;
		}
	}
}
function menuOut(){
//$("menuListBjImg").style.webkitTransitionDuration="0ms";
	if(focus1_pos>=0&&focus1_pos<=5){
		$("menu"+focus1_pos).src = "images/index/hd/menu"+focus1_pos+".png";
		//smallerMenuListBj();//缩小MenuListBj
	}else{
		$("menuListFocus").style.visibility = "hidden";

		menuListObj[focus1_pos-menuToList.length].style.color = blackColor;
		//isMenuListFocus = false;
	}
}
function incMenu(inc){
	if(focus1_pos+inc<0||focus1_pos+inc>MaxMenu) return false;
	if(focus1_pos>5&&inc == 6) return false;//第二列往右
	if(focus1_pos == 5&&inc == 1) return false;//第一列最后一个往下
	if(inc == -6){
		menuOut();
/*		按按钮位置移动时
		for(var i = 0; i<menuToList.length; i++){
			if(menuToList[i][0] == focus1_pos || menuToList[i][1] == focus1_pos){
				focus1_pos = i;
				break;
			}else continue;
			
		}*/
		focus1_pos = curMenu;
		
	}else if(inc == 6){
		
		focus1_pos = 6;
	}else{
		menuOut();
		focus1_pos += inc;
	}
	menuIn();
	return true;
}
////////////////////////////////左侧menu区域  function--end////////////////////////////////
var menuListObj;
//////////////////////////////////#1018修改////////////////////////////////////
function init(){

	 menuListObj = $("menuList").getElementsByTagName("div");
	for(var t=0; t<=8; t++){
		$("fun"+t).innerHTML = ser_focus0_pos.name[t];
		}
	for(var t=0; t<3; t++){
		$("l"+t).innerHTML = ser_focus2_pos.name[t];
		}
	for(var i=0; i<menuInfo[0].length; i++){
			menuListObj[i].innerHTML = menuInfo[0][i];
		}	
	
	//document.getElementById("showImg").src="images/index/index_poster_2-"+jishi%adNum+".jpg";
	rightTimer = setInterval('rightRun();',3500);
	bannerTimer = setInterval('scrollrun();',4500);
	preloader();
	adimg_in();

	
}
///////////////////////#1018修改右侧广告位滚动////////////////////////////////////////
var jishi =0;//iPanel.getGlobalVar("wasu_jishi");
var rightFocusTop = [172,337,502];//#1025修改 增加定义
var rightFocusLenght = rightFocusTop.length;
var right_index = 0;//#1025修改 增加定议
//var jishi = 1;
var adNum = 3; ///////广告个数
var rightNum = 2;//1: 热点 2：广告
if(jishi=="undefined"||jishi == null){
	jishi = 0;
}else{
	jishi = 1*jishi
	jishi += 1;
}
//iPanel.setGlobalVar("wasu_jishi",""+jishi); 
function rightRun(){
	if(rightNum==1){
		//document.getElementById("showImg").src="images/index/index_poster_2-"+jishi%adNum+".jpg";
		document.getElementById("showImg").src="images/index/index_poster_1_3_2.jpg";
		rightNum = 2;
	}else{
		rightNum = 1;
		document.getElementById("showImg").src="images/index/index_poster_1_3_2.jpg";
	}
}
function rightOut(){
	rightTimer = setInterval('rightRun();',3500);
	$("show_di").style.opacity = 0.01;
}
//#1025修改
function rightIn(){
	document.getElementById("showImg").src="images/index/index_poster_1_3_2.jpg";
	rightNum = 1;
	clearTimer(rightTimer);
	rightTimer = null;
}
//#1025修改 增加rightInc()方法
function rightInc(inc){
	var _show_di_elem = $("show_di")
	var right_index_new = right_index + inc; 
	if(right_index_new>rightFocusLenght-1 || right_index_new<0) return false;//超出本区域 返回 false
	right_index += inc;
	if(right_index == 2)
		_show_di_elem.src = "images/index/hd/show_di.png";
	else if(right_index == 1&&inc == -1)
		_show_di_elem.src = "images/index/hd/show_di.png";
	_show_di_elem.style.top = rightFocusTop[right_index]+"px";
	return true;
	
}
////////////////////////////////////#1018修改-公告滚动///////////////////////////
var currentpos=0,clicknum1=0,clicknum2=0,timer,wh=0; 
function scrollrun(){
	if(currentpos<4)
	 currentpos++;
	else{
	  currentpos=0;
	}
	document.getElementById("infoImg").src="images/index/index_banner_icon_"+(currentpos+1)+".gif";
	ser_focus3_pos.url[0] = bannerURL[currentpos];
}	


//视频流播放
function play()
{
		
		//8005
}
//视频流关闭
function closeit()
{
		
}


//遥控器按键
document.onkeypress = grabEvent;
document.onirkeypress = grabEvent;
document.onkeydown = grabEvent;
function grabEvent(event){
	var key_code = event.which;

		switch(key_code){
		case 1://上
		case 38:
			up();
			return 0;
			break;
			
		case 2://下
		case 40:
			down();
			return 0;
			break;
			
		case 3://左
		case 37:
			left();
			return 0;
			break;
			
		case 4://右
		case 39:
			right();
			return 0;
			break;
		
		case 13://确定
			returnhref();
			return 0;
			break;
		
		case 513://菜单键
			window.location.href="http://utc.hzdtv.tv:80/folder/iptvtest/RDIPTV_HZHX_IPS_02133041916646915/iptvtest_001.page";
			return 0;
			break;
	}
}

//确认按钮
function returnhref(){
	if(flag==0){
		window.location.href=ser_focus0_pos.url[focus0_pos];
		}
	else if(flag==1){
		if(focus1_pos>5){
			window.location.href=menuHref[curMenu][focus1_pos-6];
		}else{
			window.location.href=tagHref[focus1_pos];
		}
	}
	else if(flag==2){
			if(focus2_pos==3){
			//alert(focus2_pos);
			//alert(ser_focus2_pos.url[focus2_pos]);
			window.location.href=ser_focus2_pos.url[focus2_pos];
		}else{
			iPanel.overlayFrame.location.href=ser_focus2_pos.url[focus2_pos];
		}
	}
	else if(flag==3){
		window.location.href=ser_focus3_pos.url[focus3_pos];
	}
	else if(flag==4){
		window.location.href=ser_focus4_pos.url[right_index];
	}
	
}



function up(){
	if(flag == 1){
		if(focus1_pos == 0||focus1_pos == 6){
			flag = 0;
			$("top_red").style.opacity = 1;//显示顶部红色块
			menuOut();
			$("menu"+focus1_pos).src = loadImgF[curMenu].src;
			//biggerMenuListBj();
			}
		else {
			incMenu(-1);
		}
	}
	else if(flag == 2){
		if(focus2_pos == 0){
			flag = 0;
			$("l"+focus2_pos).style.color = "#000000";//字变黑色
			$("float_choose").style.opacity = 0.01;//隐藏红条
			$("top_red").style.opacity = 1;//顶部红色块显示
			}
		else if((focus2_pos>=1)&(focus2_pos<=2)){
			$("l"+focus2_pos).style.color = "#000000"; //前一个变成黑的
			focus2_pos -= 1;
			$("l"+focus2_pos).style.color = "#ffffff";//后一个变成白的
			$("float_choose").style.top = 517+focus2_pos*33+"px";//改变红条的top
			}
		}
	else if(flag == 3){
		flag = 2;
		$("la0").src = "images/index/la.png";//小喇叭换灰图
		$("more").style.opacity = 0.01;//"更多"的红色底图隐藏
		$("more_le").style.color = "#000000";//"更多"字变黑色
		focus2_pos = 2;
		$("l"+focus2_pos).style.color = "#ffffff";//变白
		$("float_choose").style.opacity = 1;//显示红条
		$("float_choose").style.top = 517+focus2_pos*33+"px";//改变红条的top
		}
	else if(flag == 4){
	///////#1025修改 begin
		if(!rightInc(-1)){
			rightOut();
			flag = 0;
			$("show_di").style.opacity = 0.01;//右侧广告红底隐藏
			$("top_red").style.opacity = 1;//顶部红色块显示
		}
	////////#1025修改   end 
	}
	else if(flag == 5){
		if((fun_pos >= 1)&(fun_pos <= 4)){
			$("left_f"+fun_pos).src = "images/index/left_fun"+fun_pos+".png";
			fun_pos -= 1;
			$("left_f"+fun_pos).src = "images/index/left_fun"+fun_pos+"_chg.png";
			}
		else if(fun_pos == 0){
			flag = 0;
			$("left_f0").src = "images/index/left_fun0.png";
			$("top_red").style.opacity = 1;//显示顶部红色块
			}
	}
}

function down(){
	if(flag == 0){////////flag=0的时候 第1 2个按钮按下跳flag=1  第3 4 5 6个按钮按下跳flag=2  第7 8 个按钮按下跳flag=4
		if((focus0_ca>=0)&&(focus0_ca<=1)){
			flag = 1;
			menuIn();
			$("top_red").style.opacity = 0.01;
			}
		else if((focus0_ca>=2)&&(focus0_ca<=5)){
			flag = 2;
			focus2_pos = 0;
			$("top_red").style.opacity = 0.01;
			$("float_choose").style.top = 517+focus2_pos*33+"px";
			$("float_choose").style.opacity = 1;
			$("l"+focus2_pos).style.color = "#ffffff";
			}
		else if((focus0_ca>=6)&&(focus0_ca<=8)){
			
			flag = 4;
			rightIn();
			$("top_red").style.opacity = 0.01;
			$("show_di").style.opacity = 1;
			}
		}
	else if(flag == 1){
		incMenu(1);
		}
	else if(flag == 2){
		if((focus2_pos>=0)&(focus2_pos<=1)){
			$("l"+focus2_pos).style.color = "#000000"; //前一个变成黑的
			focus2_pos += 1;
			$("l"+focus2_pos).style.color = "#ffffff";//后一个变成白的
			$("float_choose").style.top = 517+focus2_pos*33+"px";//改变红条的top
			}
		else if(focus2_pos == 2){
			flag = 3;
			$("l"+focus2_pos).style.color = "#000000"; //字变成黑的
			$("float_choose").style.opacity = 0.01;//隐藏红条
			focus3_pos = 0;
			$("la0").src = "images/index/la_chg.png";
			}
	}else if(flag == 4){
		rightInc(1);
	}
}
/////////////////////#1018修改/////////////////////////////////////////////////////////
function left(){
	if(flag == 0){
		if((focus0_ca>=1)&(focus0_ca<=8)){
			focus0_ca -= 1;
			focus0_pos -= 1;
			if(focus0_pos<0)
				focus0_pos = ser_focus0_pos.name.length-1; 
			$("top_red").style.left = 122+focus0_ca*118+"px";
			//red_point();
			}
		else if(focus0_ca == 0){
			focus0_ca = 8;
			if(focus0_pos == 0)
				focus0_pos = ser_focus0_pos.name.length-1;
			else
				focus0_pos = 8;

			for(var t=0; t<9; t++){
				$("fun"+t).innerHTML = ser_focus0_pos.name[t+(focus0_pos-focus0_ca)];
			}
			$("top_red").style.left = 122+focus0_ca*118+"px";
			red_point();
			
		}
	}
	else if(flag == 1){
		incMenu(-6);
		}
	else if(flag == 2){
		if((focus2_pos>=0)&(focus2_pos<=2)){
			flag = 1;
			$("float_choose").style.opacity = 0.01;
			$("l"+focus2_pos).style.color = "#000000";
			menuIn();
			}
		}
	else if(flag == 3){
		if(focus3_pos == 0){
			flag = 1;
			$("la0").src = "images/index/la.png";
			if(focus1_pos == 0){
				$("left_f0").src = "images/index/left_fun0_chg.png";
				$("long0").style.opacity = 1;
				}
			else if((focus1_pos == 2)||(focus1_pos == 4)||(focus1_pos == 6)){
				$("left_f0").src = "images/index/left_fun0_chg.png";
				$("short0").style.opacity = 1;
				}
			else if((focus1_pos == 8)||(focus1_pos == 10)){
				$("left_f1").src = "images/index/left_fun1_chg.png";
				$("short1").style.opacity = 1;
				}
			else if(focus1_pos == 11){
				$("left_f1").src = "images/index/left_fun1_chg.png";
				$("long1").style.opacity = 1;
				}
			else if((focus1_pos == 13)||(focus1_pos == 15)){
				$("left_f2").src = "images/index/left_fun2_chg.png";
				$("short2").style.opacity = 1;
				}
			else if(focus1_pos == 16){
				$("left_f2").src = "images/index/left_fun2_chg.png";
				$("long2").style.opacity = 1;
				}
			else if(focus1_pos == 19){
				$("left_f3").src = "images/index/left_fun3_chg.png";
				$("short3").style.opacity = 1;
				}
			else if((focus1_pos == 17)||(focus1_pos == 20)){
				$("left_f3").src = "images/index/left_fun3_chg.png";
				$("long3").style.opacity = 1;
				}
			else if((focus1_pos == 22)||(focus1_pos == 24)||(focus1_pos == 26)){
				$("left_f4").src = "images/index/left_fun4_chg.png";
				$("short4").style.opacity = 1;
				}
			}
		else if(focus3_pos == 1){
			focus3_pos = 0;
			$("more").style.opacity = 0.01;
			$("more_le").style.color = "#000000";
			$("la0").src = "images/index/la_chg.png";
			}
		}
	else if(flag == 4){
		rightOut();
		flag = 2;
		$("l"+focus2_pos).style.color = "#ffffff";//#000000黑色  #ffffff白色
		$("float_choose").style.opacity = 1;
		$("float_choose").style.top = 517+focus2_pos*33+"px";
		}
}
/////////////////////#1018修改/////////////////////////////////////////////////////////
function right(){
	if(flag == 0){
		if((focus0_ca>=0)&(focus0_ca<=7)){
			focus0_ca += 1;
			focus0_pos += 1;
			$("top_red").style.left = 122+focus0_ca*118+"px";
			
			}
		else if(focus0_ca == 8){
			focus0_ca = 0;
			if(focus0_pos == 8)
				focus0_pos = 9;
			else
				focus0_pos= 0;

			for(var t=0; t<9; t++){
				$("fun"+t).innerHTML = ser_focus0_pos.name[t+(focus0_pos-focus0_ca)];
			}
			$("top_red").style.left = 122+focus0_ca*118+"px";
			red_point();
		}
	}
	else if(flag == 1){
		if(focus1_pos<6){
			$("menu"+focus1_pos).src = loadImgF[focus1_pos].src;
		}
		if(!incMenu(6)){
			menuOut();
			flag = 2;
			focus2_pos = 0;
			$("float_choose").style.top = 517+focus2_pos*33+"px";
			$("float_choose").style.opacity = 1;
			$("l"+focus2_pos).style.color = "#ffffff";
		}
	}
	else if(flag == 2){
			$("l"+focus2_pos).style.color = "#000000";//#000000黑色  #ffffff白色
			$("float_choose").style.opacity = 0.01;
			flag = 4;
			rightIn();
			
			$("show_di").style.opacity = 1;
		}
	else if(flag == 3){
		if(focus3_pos == 0){
			focus3_pos = 1;
			$("la0").src = "images/index/la.png";
			$("more").style.opacity = 1;
			$("more_le").style.color = "#ffffff";
			}
		else if(focus3_pos == 1){
			rightIn();
			flag = 4;
			$("more").style.opacity = 0.01;
			$("more_le").style.color = "#000000";
			$("show_di").style.opacity = 1;
			}
		}
	else if(flag == 5){
		flag = 2;
			$("left_f"+fun_pos).src = "images/index/left_fun"+fun_pos+".png";
		$("float_choose").style.opacity = 1;
		$("l"+focus2_pos).style.color = "#ffffff";
		}
}

function red_point(){
	if(focus0_pos == 9||focus0_pos == 17){//#1025修改
		$("red_point").style.left = 1174+11+"px";
		//$("arrowL").style.visibility ="visible";
		//$("arrowR").style.visibility ="hidden";
	}
	else
		$("red_point").style.left = 1174+"px";
		//$("arrowR").style.visibility ="visible";
		//$("arrowL").style.visibility ="hidden";
	}


function get_tstv_channellist(){
//var tsg_get = iPanel.getGlobalVar("210e_tsg_get");
//if( (typeof(tsg_get) == "undefined" ||  tsg_get == "") && (iPanel.eventFrame.userChannelList.length <= 0 )){
//var STB_status_tsg = iPanel.misc.getGlobal("TERMINAL_TSGURL");
//iPanel.eventFrame.getChannelList(STB_status_tsg);
//iPanel.setGlobalVar("210e_tsg_get", "1");
//}
 
}

function getSubStr(str,num){
    var num = num;
	if(str.length > num){
		str = str.substr(0,num)+"..";
	}
	return str;
}
function getSubStr1(str,num){
    var num = num;
	if(str.length > num){
		str = str.substr(0,num);
	}
	return str;
}
var isADimg = 0;
/*
function adimg_in(){
	ADtimer = setInterval('adimg_ch();',2000);
	}
function adimg_ch(){
	if(isADimg == 0) {
		$("adimg").src = "images/index/ad1.jpg";
		isADimg = 1;
		}
	else if(isADimg == 1){
		$("adimg").src = "images/index/ad0.jpg";
		isADimg = 0;
		}
	}
	*/